package com.zhangh.summer.admin.support.utils;

import java.util.UUID;

/**
 * @description: TODO
 * @author: zhanghui  zhanghlucky@163.com
 * @create: 2021-06-10 22:12
 **/
public class UUIDGenerator {
    /**
     * 获得32位的 UUID
     * @return uuid
     */
    public static String random32UUID() {
        return UUID.randomUUID().toString().replace("-", "").toUpperCase();
    }

    /**
     * 获得16位的UUID
     * @return uuid
     */
    public static String random16UUID() {
        String key = System.currentTimeMillis() + random32UUID();
        String uuid = MD5Util.MD5(key);
        return uuid.substring(8, 24).toUpperCase();
    }

    /**
     * 获得16位的UUID
     * @return uuid
     */
    public static String random8UUID() {
        String key = String.valueOf(System.currentTimeMillis())+ random32UUID();
        String uuid = MD5Util.MD5(key);
        return uuid.substring(8, 16).toUpperCase();
    }
}
